#ifndef _INCLUDE_STRING_H_
#define _INCLUDE_STRING_H_

#include "stdint.h"

/**
 * @brief Sets the first 'size' bytes of the memory block pointed to by 'dst_'
 * to the specified 'value'.
 *
 * @param dst_ Pointer to the memory block to set.
 * @param size Number of bytes to set.
 * @param value Value to be set (as an unsigned 8-bit integer).
 */
void memset(void* dst_, uint32_t size, uint8_t value);

/**
 * @brief Copies 'size' bytes from 'src_' to 'dst_'.
 *
 * @param src_ Pointer to the source memory location.
 * @param dst_ Pointer to the destination memory location.
 * @param size Number of bytes to copy.
 */
void memcpy(const void* src_, void* dst_, uint32_t size);

/**
 * @brief Compares the memory blocks pointed to by 'a_' and 'b_' up to 'size'
 * bytes.
 *
 * @param a_ Pointer to the first memory block.
 * @param b_ Pointer to the second memory block.
 * @param size Number of bytes to compare.
 *
 * @return An integer less than, equal to, or greater than zero if the first
 * 'size' bytes of 'a_' are found, respectively, to be less than, to match, or
 * be greater than the first 'size' bytes of 'b_'.
 */
int memcmp(const void* a_, const void* b_, uint32_t size);

/**
 * @brief Copies the string pointed to by 'src_' (including the null terminator)
 * to the memory pointed to by 'dst_'.
 *
 * @param src_ Pointer to the source string.
 * @param dst_ Pointer to the destination memory location.
 * @return Pointer to 'dst_'.
 */
char* strcpy(const char* src_, char* dst_);

/**
 * @brief Computes the length of the string pointed to by 'str', excluding the
 * null terminator.
 *
 * @param str Pointer to the null-terminated string.
 * @return Length of the string pointed to by 'str'.
 */
uint32_t strlen(const char* str);

/**
 * @brief Locates the first occurrence of the character 'ch' in the string
 * 'str', searching from left to right.
 *
 * @param str Pointer to the null-terminated string to be searched.
 * @param ch The character to be located.
 * @return Pointer to the first occurrence of 'ch' in 'str', or NULL if 'ch' is
 * not found.
 */
char* strchr(const char* str, const uint8_t ch);

/**
 * @brief Locates the last occurrence of the character 'ch' in the string 'str',
 * searching from right to left.
 *
 * @param str Pointer to the null-terminated string to be searched.
 * @param ch The character to be located.
 * @return Pointer to the last occurrence of 'ch' in 'str', or NULL if 'ch' is
 * not found.
 */
char* strrchr(const char* str, const uint8_t ch);

/**
 * @brief Concatenates the string pointed to by 'src_' to the end of the string
 * pointed to by 'dst_'.
 *
 * @param dst_ Pointer to the destination string.
 * @param src_ Pointer to the source string to be appended.
 * @return Pointer to 'dst_'.
 */
char* strcat(char* dst_, const char* src_);

/**
 * @brief Counts the number of occurrences of the character 'ch' in the string
 * 'str'.
 *
 * @param str Pointer to the null-terminated string to be searched.
 * @param ch The character to be counted.
 * @return Number of occurrences of 'ch' in 'str'.
 */
uint32_t strchrs(const char* str, uint8_t ch);

#endif
